﻿<phone:PhoneApplicationPage 
    x:Class="WeiboPlus.Shell.Views.AccountManagmentView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
     xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
   
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
     Foreground="LightGray" 
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="{StaticResource BackroundBrush}" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="6,0,0,28">
            <Rectangle Fill="{StaticResource PhoneAccentBrush}" Height="10" Width="132" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="9,0,0,6" ></Rectangle>
            <TextBlock x:Name="ApplicationTitle"  Foreground="LightGray"  Text="{Binding WeiboPlusText, Source={StaticResource AppResx}}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle"  Foreground="LightGray"  Text="{Binding AccountManagementText, Source={StaticResource AppResx}}" Margin="9,-7,0,0" FontSize="48" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here ItemTemplate="{StaticResource UserListDataTemplateLite}"-->

        <toolkit:MultiselectList Margin="0,20,20,10" SelectionChanged="accountList_SelectionChanged" x:Name="accountList" Grid.Row="2"  ItemsSource="{Binding BindedAccounts}" >
            <toolkit:MultiselectList.ItemContainerStyle>
                <Style TargetType="toolkit:MultiselectItem">
                    <Setter Property="HintPanelHeight" Value="90"/>
                    <Setter Property="Margin" Value="2,18,2,0"/>
                    <Setter Property="VerticalAlignment" Value="Bottom"/>
                    <Setter Property="VerticalContentAlignment" Value="Bottom"/>
                    <Setter Property="BorderThickness" Value="0,0,0,1"/>
                    <Setter Property="BorderBrush" Value="{StaticResource ListItemBorderBrush}"/>
                </Style>
            </toolkit:MultiselectList.ItemContainerStyle>
            <toolkit:MultiselectList.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="2">
                        <TextBlock Text="{Binding UserLite.Name}" 
                                       Margin="0,-10,0,-4"  Foreground="LightGray" 
                                       FontSize="{StaticResource PhoneFontSizeLarge}" 
                                       FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>

                        <TextBlock Text="{Binding UserLite.AccountName}" 
                                       Foreground="{StaticResource PhoneAccentBrush}"
                                       FontSize="{StaticResource PhoneFontSizeNormal}"/>
                    </StackPanel>
                </DataTemplate>
            </toolkit:MultiselectList.ItemTemplate>
            <toolkit:MultiselectList.ItemInfoTemplate>
                <DataTemplate>
                    <!--<Border>
                        <Image delay:LowProfileImageLoader.UriSource ="{Binding UserLite.ProfileImageUrl}" VerticalAlignment="Top" Margin="2"  Height="60" Width="60" Tap="ViewUserHome">
                            <Image.Clip>
                                <RectangleGeometry RadiusX="2" RadiusY="2" Rect="0,0,60,60"/>
                            </Image.Clip>
                        </Image>
                    </Border>-->
                    <Grid Width="110"  Margin="0,-16,0,0" >
                        <CheckBox Margin="0,-8,0,0" IsChecked="{Binding IsActive,Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Top"  />
                        <Image HorizontalAlignment="Right" VerticalAlignment="Top" Height="60" Width="60" Tap="ViewUserHome" delay:LowProfileImageLoader.UriSource ="{Binding UserLite.ProfileImageUrl}">
                            <Image.Clip>
                                <RectangleGeometry RadiusX="2" RadiusY="2" Rect="0,0,60,60"/>
                            </Image.Clip>
                        </Image>
                        <Path VerticalAlignment="Top" Margin="50,0,0,0" Data="M0,0 L0,24 L24,0 Z" Fill="{Binding AccountID,Converter={StaticResource IntToAccentColorConverter}}"  />
                    </Grid>
                </DataTemplate>
            </toolkit:MultiselectList.ItemInfoTemplate>
        </toolkit:MultiselectList>
               

        <StackPanel Grid.Row="1" Margin="20,0,0,10" Orientation="Horizontal" HorizontalAlignment="Stretch">
            <toolkit:ListPicker Width="240"  Style="{StaticResource ListPickerStyle}"  Margin="2" ItemTemplate="{StaticResource ProviderPickerItemTemplate}" ExpansionMode="ExpansionAllowed" ItemsSource="{Binding SupportedProviders}" SelectedItem="{Binding SelectedProvider,Mode=TwoWay}" d:LayoutOverrides="Height">
                <toolkit:ListPicker.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical" Background="LightYellow"></StackPanel>
                    </ItemsPanelTemplate>
                </toolkit:ListPicker.ItemsPanel>
            </toolkit:ListPicker>
                    <Button Width="220" HorizontalContentAlignment="Right"  HorizontalAlignment="Right" VerticalAlignment="Top" Content="{Binding AddNewAccountText, Source={StaticResource AppResx}}" BorderThickness="0" Foreground="{StaticResource PhoneAccentBrush}" Command="{Binding Authorize}" />
                </StackPanel>
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar      <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Opacity=".5">
            <!--
            <shell:ApplicationBarIconButton Click="OnRefreshClick" IconUri="/Images/AppBarIcons/refresh.png" Text="{Binding RefreshText, Source={StaticResource AppResx}}"/>
            <shell:ApplicationBarIconButton IconUri="/Images/AppBarIcons/delete.png" Click="OnDeleteAccountClick" Text="{Binding DeleteAccountText, Source={StaticResource AppResx}}"/>
            -->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>
